home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / miscpas.zip / MATH22.PAS < prev    next >
Pascal/Delphi Source File  |  1984-07-01  |  31KB  |  750 lines

  1.  
  2.  
  3. (*******************************************************************)
  4. (*                                                                 *)
  5. (*   Math22.   Graphics and explanations of Pythagoras Theorem,    *)
  6. (*   right triangles, and topics which arise from them. This is    *)
  7. (*   Program #1 of Group #2 of the  Foundations of Mathematics     *)
  8. (*   Series.             Robert G. Hoffmann          Sept 1985.    *)
  9. (*                                                                 *)
  10. (*******************************************************************)
  11.  
  12. Program PythTheorem;
  13.  
  14. Var  Xlow,Yhi,Vlen,Hlen,I,J,val : Integer;   (* Box locator and lengths.*)
  15.                     ex,gd,ch,zh : Char;
  16.                        Ccontrol : File;
  17. {========================================================================}
  18. Procedure key;
  19. Begin
  20.     Gotoxy(30,25); Write('Press any key');
  21.       Read(Kbd,gd);  If gd='' then key;
  22.     Gotoxy(10,25); For I:=1 to 40 do Write(#32);
  23.  
  24. end;  (* Procedure key. *)
  25. {-------------------------------------------------------------------}
  26. Procedure Out;   (* Deletes line in Hires. Delline louses up screen.*)
  27.   Begin For J:=1 to 70 do write(#32);
  28. end;
  29. (*******************************************************************)
  30. (*                                                                 *)
  31. (*       Explanations of Trig foundations in this Procedure.       *)
  32. (*                                                                 *)
  33. (*******************************************************************)
  34.                         Procedure Boxes; Forward;
  35. Procedure Triangles;
  36.  
  37. Var   X1,X2,X3,Y1,Y2,Y3  : Integer;
  38.  
  39. {===================================================================}
  40.  
  41. Begin        Hires;
  42. Writeln('                       Trigonometry Definitions   ');
  43. Write('                       ~~~~~~~~~~~~~~~~~~~~~~~~   ');
  44.  
  45. Gotoxy(37,6); Write(#224);
  46.         X1:=120;  Y1:= 45;
  47.         X2:=200;  Y2:= 40;
  48. Draw(X1,Y1,X2,Y2,1);        (* Left triangle.*)
  49. Draw(X1,Y1,X2,Y1,1);
  50. Draw(X2,Y1,X2,Y2,1);
  51.         X1:=270;  Y1:= 48;
  52.         X2:=330;  Y2:= 18;
  53. Draw(X1,Y1,X2,Y2,1);        (* Middle triangle.*)
  54. Draw(X1,Y1,X2,Y1,1);
  55. Draw(X2,Y1,X2,Y2,1);
  56.         X1:=410;  Y1:= 45;
  57.         X2:=420;  Y2:=  5;
  58. Draw(X1,Y1,X2,Y2,1);        (* Right triangle.*)
  59. Draw(X1,Y1,X2,Y1,1);
  60. Draw(X2,Y1,X2,Y2,1);
  61.   Gotoxy(1,9);
  62. Writeln('         Above are 3 right triangles.  Different shapes result from ');
  63. Writeln('         different side lengths.  The lower angle is identified by  ');
  64. Writeln('         ',#224,' (Greek letter Alpha), which helps describe shapes too.');
  65. Writeln('           Small angle, flat triangle; big angle, tall triangle.   ');
  66.   Key;
  67.   Gotoxy(1,14);
  68. Writeln('         For now, consider clumsy definitions of their side-length  ');
  69. Writeln('             ratios - as given in books on trigonometry basics.     ');
  70.   Key;
  71.     For I:= 1 to 7 do begin
  72.       Gotoxy(1,8+I); Out;
  73.     end;
  74. Gotoxy( 2,11); Write('hyp');
  75. Gotoxy(12,12); Write('opp');
  76. Gotoxy( 5,15); Write('adj');
  77. Gotoxy( 5,13); Write(#224);
  78.                    X1:= 8;  Y1:=107;
  79.                    X2:=74;  Y2:= 71;
  80.   Draw(X1,Y1,X2,Y2,1);
  81.   Draw(X1,Y1,X2,Y1,1);
  82.   Draw(X2,Y1,X2,Y2,1);
  83.  
  84. Gotoxy(18,11);Write(' Hypotenuse (hyp) is the long side of the triangle.   ');
  85. Gotoxy(18,12);Write(' Adjacent   (adj) is the side nearest  the angle ',#224,'.');
  86. Gotoxy(18,13);Write(' Opposite   (opp) is the side opposite the angle ',#224,'.');
  87.   Key;
  88. Gotoxy(16,15);Write(' Ratios of pairs of side lengths are formed which are:  ');
  89. Gotoxy(16,16);Write('   the Sine, Cosine, and Tangent of the angle Alpha.   ');
  90.   Key;
  91. Gotoxy(16,18);Write(' We don`t show the ratio definitions first given in  ');
  92. Gotoxy(16,19);Write(' textbooks.  We give `more advanced` ones.  They are ');
  93. Gotoxy(16,20);Write('   easier to understand and relate to other things!  ');
  94. Gotoxy(16,21);Write('                 Here they are:    ');
  95. Gotoxy(16,22);Write('                 --------------    ');
  96.   Key;
  97.    For I:=1 to 12 do begin
  98.      Gotoxy(16,10+I); For J:= 1 to 60 do Write(#32);
  99.    end;
  100. Gotoxy(16, 9);Write('    Consider the triangle drawn on rectangular    ');
  101. Gotoxy(16,10);Write('        coordinates.  We will then have:          ');
  102. Gotoxy(16,11);Write('        --------------------------------          ');
  103.   Key;
  104. Gotoxy(2,11); Write('   '); Gotoxy(12,12); Write('   ');
  105.  
  106.        Y2:=64; X2:=106;
  107.        Draw(X1,Y1,X1,Y2,1);
  108.        Draw(X1,Y1,X2,Y1,1);
  109.     Gotoxy(10,12); Write('y'); Gotoxy(5,15); Write('   ');
  110.     Gotoxy( 7,14); Write('x');
  111.     Gotoxy(5,11); Write('r');
  112.   Key;
  113. Gotoxy(16,12);Write('  For the angle Alpha, these ratios are defined:  ');
  114. Gotoxy(16,14);Write('       Sin = y/r   Cos = x/r   Tan = y/x          ');
  115.   Key;
  116. Gotoxy(16,16);Write('      Draw the diagram so that r = 1, then:      ');
  117.   Key;
  118. Gotoxy(5,11);Write('1');
  119. Gotoxy(16,14);Write('       Sin = y     Cos = x     Tan = y/x.         ');
  120.   Key;
  121. Gotoxy(16,16);Write('And, thanks to Pythagoras`s theorem, we also have: ');
  122. Gotoxy(16,18);Write('      1 = y',ex,' + x',ex,'   and   1 = sin',ex,' + cos',ex,'.');
  123. Gotoxy(16,19);Write('      -----------         ---------------           ');
  124.   Key;
  125. Gotoxy(12,20);Write(' If we let Alpha range from 0 to 90 degrees (r = 1), then ');
  126.   Key;
  127. Gotoxy(16,21);Write('   1. The sin and cos values range from 0 to 1.  As    ');
  128. Gotoxy(16,22);Write('         one goes up, the other goes down.                    ');
  129. Gotoxy(16,23);Write('   2. The tan values range from 0 to infinity.         ');
  130. Gotoxy(16,24);Write('   -------------------------------------------         ');
  131.   Key;
  132. Gotoxy(1,1); For I:=1 to 9 do Out;
  133.          Xlow:=10;  Yhi:=1;
  134.          Hlen:=59; Vlen:=5;   Boxes;
  135.  
  136. Gotoxy(12,3);Write(' Now shown on the screen are Foundations of Trigonometry. ');
  137. Gotoxy(12,4);Write(' These relationships open the door to map making and loc- ');
  138. Gotoxy(12,5);Write(' ating things on them.  Learn to make your own maps too. ');
  139. Gotoxy(12,6);Write('       Learn to make them of space - and of time.        ');
  140.   Key;
  141.  
  142. end;    (* Procedure Triangles.*)
  143. {-------------------------------------------------------------------}
  144.                          Procedure MainControl; Forward;
  145. Procedure Whereto;
  146. Begin
  147.   If ch='5' then begin
  148.     Gotoxy(28,25);  Write('Press `M` for Menu.');
  149.   end;
  150.   If ch<>'5' then begin
  151.     Gotoxy(15,25);
  152.       Write('    Press `N` for next topic, `M` for Menu.    ');
  153.   end;
  154.     Repeat
  155.       Read(Kbd,zh);
  156.       zh:=upcase(zh);
  157.     until (zh IN ['N','M']);
  158.   If zh='M' then MainControl;
  159. end;  (* Procedure Whereto *)
  160.  
  161. {------------------------------------------------------------------------}
  162. Procedure Boxes;
  163. (*           Box drawing procedure.  Define by upper left corner and
  164.                lengths of horizontal and vertical lines.  Xlow,Yhi
  165.                    and lengths input just before Boxes call.  *)
  166. Begin
  167.  
  168. Gotoxy(Xlow, Yhi);   Write(#218);     (* Position upper left corner. *)
  169.   For I:=1 to Hlen do begin           (* Write top line and corners. *)
  170.      Write(#196);
  171.   end;
  172.     Write(#191);
  173.  
  174.     Xlow:=Xlow+Hlen+1;              (*   X is same for vertical.    *)
  175.   For I:=1 to Vlen do begin         (*  Write R vertical and corner.*)
  176.     Yhi:=Yhi+1;
  177.       Gotoxy(Xlow, Yhi);
  178.         Write(#179);
  179.   end;
  180. Gotoxy(Xlow, Yhi+1);  Write(#217);
  181.  
  182.     Yhi:=Yhi+1;
  183.   For I:=1 to Hlen do begin         (*  Y same for horizontal.*)
  184.     Xlow:=Xlow-1;
  185.       Gotoxy(Xlow, Yhi);
  186.         Write(#196);
  187.   end;
  188. Gotoxy(Xlow-1, Yhi);  Write(#192);
  189.  
  190.     Xlow:=Xlow-1;                   (*  X same for vertical. *)
  191.   For I:=1 to Vlen do begin
  192.     Yhi:=Yhi-1;
  193.       Gotoxy(Xlow, Yhi);
  194.         Write(#179);
  195.   end;
  196. end;   (* Procedure Boxes. *)
  197. {---------------------------------------------------------------------}
  198.  
  199. Procedure Circles;
  200.  
  201. (* This draws nice circles, or arcs of them.  You must specify
  202.   the center (Xc,Yc) and other obvious things.  Remember that you
  203.                     are in HiRes too!
  204. *)
  205.   Var                   Np,Xc,Yc,I,X,Y : Integer;
  206.            Yr,Xr,Scale,Xrange,Yrange,A : Real;
  207.  
  208.  
  209. {===================================================================}
  210. Begin
  211.  
  212.     A:=0;  Np:=200;  Xrange:=106;  Yrange:=54;  Xc:=224;  Yc:=76;
  213.  
  214.       Scale:=2*Pi/(Np);         (* 2Pi/Np makes FULL CIRCLE. *)
  215.                                     (* Change as wanted. *)
  216.   For I:= 1 to Np+1 do begin
  217.  
  218.     Xr:=Round(Cos( A)*Xrange + Xc);   X:=Trunc(Xr);
  219.     Yr:=Round(Sin(-A)*Yrange + Yc);   Y:=Trunc(Yr);
  220.         A:=A+Scale;
  221.     Plot(X,Y,1);
  222.   end;
  223. end;   (* Procedure Circles. *)
  224.  
  225. {---------------------------------------------------------------------}
  226. (********************************************************************)
  227. (*                                                                  *)
  228. (*   This is orientation material.  For the novice in mathematics,  *)
  229. (*   it explains how we approach developing modules of the founda-  *)
  230. (*   tions of mathematics.  For those familiar with mathematics,    *)
  231. (*   it shows how the subject matter can be presented clearly and   *)
  232. (*   simply, I hope.                                                *)
  233. (*                                                                  *)
  234. (********************************************************************)
  235. Procedure Approach;
  236.  
  237. Begin   Clrscr;   ex:=#253;
  238.  
  239. Gotoxy(1,3);
  240. Writeln('                     A Reminder about Equations.                ');
  241. Writeln('                     ~~~~~~~~~~~~~~~~~~~~~~~~~~                 ');
  242. Writeln('        In the program Math21, we saw that an equation is the   ');
  243. Writeln('        `communicating unit` in mathematics.                    ');
  244.   Writeln;
  245. Writeln('        We also saw that both sides of an equation have the     ');
  246. Writeln('        same value.  We make them that way.                     ');
  247.   Writeln;
  248. Writeln('        However, we may write anything, and say that both sides ');
  249. Writeln('        have the same value.  But is it true?                   ');
  250.   Key;Gotoxy(1,14);
  251. Writeln('        So demonstrating the truth of mathematical expressions, ');
  252. Writeln('        (equations) is a vital and interesting part of math.    ');
  253.   Writeln;
  254. Writeln('        We introduce the subjects of demonstrations and trian-  ');
  255. Writeln('        gles with a cornerstone expression of the foundations   ');
  256. Writeln('        of mathematics:                                         ');
  257.   Writeln;
  258. Writeln('                      The Theorem of Pythagoras.                ');
  259. Writeln('                      --------------------------                ');
  260.   Key;Clrscr;
  261.  
  262. Gotoxy(1,6);
  263.   Writeln('                        The Theorem of Pythagoras');
  264.   Writeln('                        ~~~~~~~~~~~~~~~~~~~~~~~~~');
  265. Gotoxy(1,9);
  266. Writeln('          Pythagoras`s theorem is at the heart of the foundations ');
  267. Writeln('                     of mathematics.  Here it is in words: ');
  268. Writeln;
  269. Writeln;
  270. Writeln('                   For ANY right triangle,  the square of   ');
  271. Writeln('                   the longest side equals the sum of the   ');
  272. Writeln('                       squares of the 2 shorter sides.      ');
  273.           Xlow:=18;  Hlen:=40;
  274.            Yhi:=12;  Vlen:= 3;
  275.                 Boxes;
  276.   Key;
  277. Gotoxy(1,18);
  278. Writeln('                  We want to demonstrate the truth of this. ');
  279. Writeln('         We want to learn how to approach similar relationships too.');
  280. Writeln('                             What shall we do?                    ');
  281.   Key;
  282. Gotoxy(1,1); for I:=1 to 11 do Delline;
  283. Gotoxy(1,11);
  284.  
  285. Writeln('            Common sense is to start with known truths. Things ');
  286. Writeln('            obviously true,  or their truth has been verified  ');
  287. Writeln('            previously.  Put together known truths, and we can ');
  288. Writeln('            see other truths - sometimes.  That`s what we do! ');
  289.   Key;
  290. Gotoxy(1,16);
  291. Writeln('            ===>  We need just 2 simple facts.  They are: <=== ');
  292. Writeln;
  293. Writeln('           1. Any number can be written as the sum of 2 smaller ');
  294. Writeln('                numbers.  We may square their sum too.       ');
  295.   Key;
  296.   Gotoxy(1,20);
  297. Writeln;
  298. Writeln('           2. The area of a square (or rectangle) can be divided   ');
  299. Writeln('              exactly in half with a diagonal through opposite     ');
  300. Writeln('              corners.    Two right triangles are thus formed.     ');
  301.   Gotoxy(15,24); For I:=1 to 48 do Write(#196);
  302.   Key;
  303. Gotoxy(1,1); For I:=1 to 17 do Delline;
  304. Gotoxy(1,9);
  305.  
  306. Writeln('                   The first truth in symbols and numbers.         ');
  307. Writeln('                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~         ');
  308.   Key;
  309. Gotoxy(1,11);
  310. Write('            (a + b)',ex,' = a',ex,' + 2ab + b',ex);
  311. Writeln('    (3 + 2)',ex,' = 3',ex,' + 2x3x2 + 2',ex);
  312. Writeln('                                                 = 9  +  12   + 4. ');
  313. Writeln('                                                 = 25.               ');
  314.   Key;
  315.   Gotoxy(1,15);
  316. Writeln('                    A picture example of the second truth. ');
  317. Writeln('                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ');
  318.   Key;
  319.  
  320.   Xlow:=20;  Yhi:=17;                     (* Draw square of 9. *)
  321.   Hlen:=11;  Vlen:=5;    Boxes;
  322.  
  323.   Gotoxy(21,19); for I:=1 to 11 do Write(#196);
  324.   Gotoxy(21,21); for I:=1 to 11 do Write(#196);
  325.     For I:= 1 to 5 do begin
  326.       Gotoxy(24,17+i); Write(#179);
  327.       Gotoxy(28,17+i); Write(#179);
  328.     end;
  329.     For I:=1 to 7 do begin
  330.       Gotoxy(18+i*2,24-i); Write(#250);
  331.     end;
  332.     Key;
  333. Gotoxy(38,18);Write('We use numbers for lengths  ');
  334. Gotoxy(38,19);Write('and squares.  YOU must keep ');
  335. Gotoxy(38,20);Write('track of how you use them.  ');
  336. Gotoxy(38,21);Write('Lines are sides of squares. ');
  337.     Key;
  338.   Gotoxy(38,18);
  339.     Write('A square of    Symbols       ');
  340.   Gotoxy(38,19);
  341.     Write('~~~~~~~~~~~    ~~~~~~~       ');
  342.   Gotoxy(38,20);
  343.     Write(' Sides = 3        a           ');
  344.   Gotoxy(38,21);
  345.     Write('  Area = 9        a',ex,'        ');
  346.   Gotoxy(35,22);
  347.     Write('Triangles = 4 1/2  (1/2)a',ex,'  ');
  348.  
  349.     Whereto;                               (* Where to next? *)
  350.       ch:='2';
  351. end;  (* Procedure Approach. *)
  352.  
  353. {---------------------------------------------------------------------}
  354. Procedure PythagGraf;
  355.  
  356. Begin
  357.          Hires;  ex:=#253;
  358.  
  359. Gotoxy(25, 1); Write('         *************************     ');
  360. Gotoxy(25, 2); Write('         *                       *     ');
  361. Gotoxy(25, 3); Write('         *   The DEMONSTRATION   *     ');
  362. Gotoxy(25, 4); Write('         *                       *     ');
  363. Gotoxy(25, 5); Write('         *************************     ');
  364. Gotoxy(25, 7); Write('          Here is how we proceed:     ');
  365.   Key;
  366. Gotoxy(25, 7); Write('         Draw 2 IDENTICAL squares.        ');
  367.  
  368.           Xlow:=1; Hlen:=20;      (* Upper Square *)
  369.            Yhi:=1;  Vlen:=9;
  370.                 Boxes;
  371.  
  372.   Xlow:=1;  Hlen:=20;              (* Lower Square *)
  373.    Yhi:=13; Vlen:=9;
  374.         Boxes;
  375.   Key;
  376. Gotoxy(25, 7); Write('    Divide the upper square into 2 rectangles       ');
  377. Gotoxy(25, 8); Write('        and 2 small squares according to:           ');
  378.  
  379. Gotoxy(25,10); Write('           (a + b)',ex,' = a',ex,' + 2ab + b',ex);
  380.   Key;
  381.  
  382.   Draw(  6,60,168,60,1);            (* Horizontal line. *)
  383.   Draw(116,84,116, 4,1);            (* Vertical line. *)
  384.  
  385.   Gotoxy(1,5);  Write('a');          (*  Label lines. *)
  386.   Gotoxy(1,10); Write('b');
  387.   Gotoxy(8,11); Write('a');
  388.   Gotoxy(19,11);Write('b');
  389.     Gotoxy( 8, 5); Write('a',#253);
  390.     Gotoxy(18,10); Write('b',#253);
  391.   Key;
  392.  
  393. Gotoxy(28,12);Write(' Sides of the upper square are divided  ');
  394. Gotoxy(28,13);Write(' into lengths a and b.   In the lower   ');
  395. Gotoxy(28,14);Write(' square, we divide them into the same   ');
  396. Gotoxy(28,15);Write('   lengths, but now make triangles.     ');
  397.   Key;
  398.  
  399.   {---------------------------------------------------------------}
  400.   Gotoxy(1,16); Write('a');        (* Label side line.*)
  401.   Gotoxy(1,22); Write('b');
  402.   Gotoxy(8,23); Write('a');
  403.   Gotoxy(19,23);Write('b');
  404.  
  405.   Draw(1  ,156,  7,156,1);         (* Mark dividing points.*)
  406.   Draw(116,178,116,182,1);
  407.     Key;
  408.   Draw(1  ,156,116,180,1);         (* Draw first triangle.*)
  409.   Draw(116,180,170,121,1);         (* Draw second triangle.*)
  410.  
  411.      Gotoxy(22,20); Write('a');
  412.      Gotoxy(22,14); Write('b');
  413.     Key;
  414.   Draw(170,121, 54,100,1);
  415.   Draw( 54,100,  1,156,1);
  416.     Key;
  417.   Gotoxy(8 ,21); Write('c');
  418.   Gotoxy(17,20); Write('c');
  419.   Gotoxy(11,18); Write('c',#253);
  420.     Key;
  421.   Draw(116,60,170, 4,1);           (* Draw diagonals,top rectangle.*)
  422.   Gotoxy(18, 5); Write('c');
  423.   Draw( 6,83,116,60,1);
  424.   Gotoxy( 8, 9); Write('c');
  425.     Key;
  426.  
  427. Gotoxy(25,12); Write('   The triangles in both squares are identical!  ');
  428. Gotoxy(25,13); Write('   In the upper square there are 4 (2 triangles  ');
  429. Gotoxy(25,14); Write('   make 1 rectangle). In the lower square there  ');
  430. Gotoxy(25,15); Write('        are 4 triangles too.  So we have:        ');
  431.   Key;
  432. Gotoxy(25,17); Write('          Upper Square     Lower Square    ');
  433. Gotoxy(25,18); Write('          ~~~~~~~~~~~~     ~~~~~~~~~~~~    ');
  434. Gotoxy(25,19); Write('         a',ex,' + b',ex,' + 2ab  =        ');
  435. Gotoxy(52,19); Write('4(',#171,')ab + c',ex          );
  436.   Key;
  437. Gotoxy(25,21); Write(' We have 2ab on both sides, so subtract it out for:');
  438.   Key;
  439. Gotoxy(40,23); Write('a',ex,' + b',ex,'  =  c',ex,'    Is true!        ');
  440.  
  441. Gotoxy(40,24); For I:=1 to 25 do Write(#196);
  442.   Key;
  443. Gotoxy(25,2); For I:=1 to 50 do Write(#32);
  444. Gotoxy(25,3); Write('          Remember this vital fact too:          ' );
  445. Gotoxy(25,4); Write('          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~          ' );
  446. Gotoxy(25,5); Write('    Pythagoras`s theorem relates the squares of  ' );
  447. Gotoxy(25,6); Write('    a, b, and c. If we know any 2 of them, just  ' );
  448. Gotoxy(25,7); Write('      `solve the equation` to get the third.      ');
  449.          Xlow:=27;  Hlen:=45;
  450.           Yhi:= 1;  Vlen:= 6;
  451.                Boxes;
  452.   Key;
  453. Whereto;                              (* Whereto next? *)
  454.   ch:='3';
  455. end;  (* Procedure PythagGraf. *)
  456. {-------------------------------------------------------------------}
  457.  
  458. (*******************************************************************)
  459. (*                                                                 *)
  460. (*  This is the last part of Program Math21. The material here is  *)
  461. (*  intended to provide "hooks" to other portions of mathematics.  *)
  462. (*  I plan to write at least some of these programs.  I hope that  *)
  463. (*  others will write them, and additional programs, too.          *)
  464. (*                                                                 *)
  465. (*******************************************************************)
  466. Procedure Hooks;
  467.  
  468. Begin     Textmode(2);
  469.   Clrscr;                             (* Transition page.*)
  470. Gotoxy(1,5);
  471.  
  472. Writeln('                 (*************************************) ');
  473. Writeln('                 (*                                   *) ');
  474. Writeln('                 (*   WHAT CAN WE DO WITH TRIANGLES   *) ');
  475. Writeln('                 (*                                   *) ');
  476. Writeln('                 (*               and                 *) ');
  477. Writeln('                 (*                                   *) ');
  478. Writeln('                 (*          c',ex,' = a',ex,' + b',ex,' ?           *) ');
  479. Writeln('                 (*                                   *) ');
  480. Writeln('                 (*************************************) ');
  481.  
  482.   Gotoxy(25,17); Write('Press any key to find out!    ');
  483.     Repeat  Read(Kbd,ch); until Keypressed=false;
  484.  
  485.   {----------------------------------------------------------------}
  486.   Clrscr;
  487. Gotoxy(1, 3);
  488. Writeln('            Uses of right triangles and Pythagoras`s theorem are  ');
  489. Writeln('                 so numerous, we sketch only a few of them.       ');
  490. Writeln('                             Here they are:                       ');
  491. Writeln('                             ~~~~~~~~~~~~~~                       ');
  492.       Key;
  493. Gotoxy(1, 8);
  494. Writeln('             1. All straight-sided shapes, no matter how many       ');
  495. Writeln('                sides, can be constructed from them.               ');
  496. Writeln;
  497. Writeln('             2. Given any figure with straight sides, it can        ');
  498. Writeln('                be divided into pieces with right triangles.           ');
  499. Writeln;
  500.       Key;
  501. Gotoxy(1,14);
  502. Writeln('             3. Circles and other curves can be generated with      ');
  503. Writeln('                the aid of right triangles.                             ');
  504. Writeln;
  505. Writeln('             4. Right triangles are the base of the branch of       ');
  506. Writeln('                mathematics we call `trigonometry.`                 ');
  507. Writeln;
  508.       Key;
  509. Gotoxy(1,20);
  510. Writeln('             5. We describe motion and time with the above.         ');
  511. Writeln;
  512. Writeln('                       Quite a lot of stuff, huh?                 ');
  513. Writeln('                       --------------------------                 ');
  514.       Key;
  515.    Clrscr;
  516. Gotoxy(1, 6);
  517. Writeln('            Shortly we will see how to do some of this.   But ');
  518. Writeln('            before looking at it, here is how to simplify the ');
  519. Writeln('                 equation.   Use it for other things too.     ');
  520.       Key;
  521. Gotoxy(12,11);
  522. Writeln(' To simplify  c',ex,' = a',ex,' + b',ex,',   divide both sides by c',ex,'.');
  523.       Key;
  524. Gotoxy(12,14);
  525.   Write(' We obtain:    1 = A',ex,' + B',ex,'.                       ');
  526. Gotoxy(42,14);
  527.   Write('[A',ex,' is a',ex,'/c',ex,', B',ex,' is b',ex,'/c',ex,'].      ');
  528.       Key;
  529. Gotoxy(1,17);
  530. Writeln('                  The number 1 is easy to work with, and  ');
  531. Writeln('                       we can change back anytime.        ');
  532. Writeln('                       ---------------------------        ');
  533.   Key;
  534.   Triangles;            (* Triangles has much Hooks material too.*)
  535. Whereto;
  536.   Ch:='4';
  537. end;      (* Procedure Hooks. *)
  538. {-------------------------------------------------------------------}
  539. Procedure More;          (* More material on relationships.*)
  540.   Begin  clrscr;
  541.  
  542.   Gotoxy(14,7);
  543. Writeln(' The last of our related materials are shown next. ');
  544. Writeln('              Some of what we have just seen will again be seen ');
  545. Writeln('                       in a somewhat different way.             ');
  546.   Writeln;
  547. Writeln('              Our main figure is a big square formed from 4     ');
  548. Writeln('              smaller squares.  Consider their center to be     ');
  549. Writeln('              the center of a rectangular coordinate system.    ');
  550.   Writeln;
  551. Writeln('              Remember that mathematics is a language, and all  ');
  552. Writeln('              things in it are related.   See these relation-   ');
  553. Writeln('                ships for the joy of learning them yourself!    ');
  554.         Xlow:=11; Yhi:=5;
  555.         Hlen:=54; Vlen:=13;  Boxes;
  556.   Key;
  557.   Hires;
  558. Gotoxy(18,1); Write('Relating Pythagoras`s Theorem to Other Topics');
  559.  
  560.                  Xlow:=15; Hlen:=26;
  561.                   Yhi:= 3; Vlen:=13;  Boxes;
  562.  
  563. Gotoxy(50,4);  Write('  CIRCLES and');
  564. Gotoxy(50,6);  Write(' TRIANGLES and');
  565. Gotoxy(50,8); Write('SQUARES (Areas).');
  566.                 Xlow:=48; Hlen:=18;
  567.                  Yhi:= 3; Vlen:= 5;   Boxes;
  568. Key;
  569.      Circles;
  570. Draw(118,76,330,76,1);               (* Coordinate axes in square.*)
  571. Draw(224,22,224,130,1);
  572.  
  573. Draw(224,76,330,76,1);                (* Make first triangle.*)
  574. Draw(224,76,300,40,1);
  575. Gotoxy(33,7);  Write('1');          (* Make radius = 1.*)
  576. Gotoxy(33,9);  Write(#224);
  577.   Key;
  578. Gotoxy(46,11);Write('  All  circles area =  ',#227,'r',#253 );
  579. Gotoxy(46,12);Write('  This circles area =  ',#227' = 3.14..');
  580. Gotoxy(46,13);Write('  Big square   area =  4               ');
  581.   Key;
  582. Gotoxy(14,19);Write(' Study carefully the relationships now shown.  We have ');
  583. Gotoxy(14,20);Write(' areas of circles and squares.   Triangles coming next. ');
  584.   Key;
  585. Draw(300,40,300,76,1);
  586. Draw(300,76,300,88,1);             (* Extend side to unit length.*)
  587. Draw(300,40,330,76,1);          (* Add chord for another triangle.*)
  588.   Key;
  589. Gotoxy(33,10); Write('cos');
  590. Gotoxy(37, 8); Write('sin');
  591.  
  592. Gotoxy(46,15);Write('  Big triangle area = (',#171,')yx       ');
  593. Gotoxy(46,16);Write('                    = (',#171,')Sin',#224,'Cos',#224 );
  594.   Key;
  595. Gotoxy(14,19);Write(' A small triangle has been added (1 side common with big ');
  596. Gotoxy(14,20);Write(' one).  Bottom length = 1-x, or 1-cos.  YOU work out its  ');
  597. Gotoxy(14,21);Write(' area.  Big+small = close to area of pie-slice of circle. ');
  598.    Key;
  599. Gotoxy(14,23);Write('  To conclude our demonstrations, here is a suggestion: ');
  600.   Key;
  601.            Xlow:= 8;   Yhi:=18;
  602.            Hlen:=66;  Vlen:= 6;    Boxes;
  603.  
  604. Gotoxy(10,19);Write('         Make a mechanical model of what you see above.          ');
  605. Gotoxy(10,20);Write('         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           ');
  606. Gotoxy(10,21);Write(' Rotate the circle to see Alpha change, the side lengths change, ');
  607. Gotoxy(10,22);Write(' and their ratios change.  1 = y',#253,' + x',#253,' is true for all.  Use a ');
  608. Gotoxy(10,23);Write(' toy clock face for mechanical parts.   Experiment with tracing  ');
  609. Gotoxy(10,24);Write('   paper center-pinned to a drawing.  Bring life to your math!   ');
  610.  
  611. Whereto;                            (* WhereTo next? *);
  612.   ch:='5';
  613. end;   (* Procedure More. *)
  614. {-------------------------------------------------------------------}
  615.  
  616. Procedure Comment;
  617. Begin                Clrscr;
  618.   Gotoxy(1,2);
  619. Writeln('                       Comments and References.                 ');
  620. Writeln('                       ~~~~~~~~~~~~~~~~~~~~~~~~                 ');
  621. Writeln('      For those who want to go further in the study of mathematics   ');
  622. Writeln('      or science, the following books are recommended.  Barnes &     ');
  623. Writeln('      Noble is a division of Harper & Row, Publishers.  Order from   ');
  624. Writeln('      any bookstore.                                                 ');
  625. Writeln;
  626. Writeln('             Barnes & Noble Thesaurus of Science.                    ');
  627. Writeln('             Barnes & Noble Thesaurus of Physics.                    ');
  628. Writeln('             Barnes & Nobel Thesaurus of Chemistry.                  ');
  629. Writeln('             Barnes & Nobel Thesaurus of Biology.                    ');
  630. Writeln('             Barnes & Nobel Thesaurus of Geology.                    ');
  631. Writeln('             Barnes & Nobel Thesaurus of Computer Science.           ');
  632. Writeln;
  633. Writeln('    The above books have the contents of profusely illustrated science   ');
  634. Writeln('    dictionaries.  The alphabetical ordering of entries in dictionaries, ');
  635. Writeln('    however, destroys much of the value of their contents.  Unrelated    ');
  636. Writeln('    topics are grouped together.  But the new Barnes & Nobel books are   ');
  637. Writeln('    in thesaurus format.  Related topics can thus be studied together.   ');
  638.   Key;
  639.     Clrscr;
  640.   Gotoxy(1,1);
  641. Writeln('          Additional useful Barnes & Nobel titles are:               ');
  642. Writeln;
  643. Writeln('           Nielsen, K. Algebra: A Modern Approach.                   ');
  644. Writeln('           Nielsen, K. Modern Trigonometry.                          ');
  645. Writeln('           Oakley, C.  Calculus, A Modern Approach.                  ');
  646. Writeln('           Bennett, C. College Physics.                              ');
  647. Writeln('           Bennett, C. Physics Problems and How to Solve Them.       ');
  648. Writeln;
  649. Writeln('      Other useful books are:                                        ');
  650. Writeln;
  651. Writeln('    Sawyer, W.         Prelude to Mathematics.  Dover Publications.   ');
  652. Writeln('    Hutchinson, C.     The Radio Amateur`s License Manual.  American  ');
  653. Writeln('      Radio Relay League.                                             ');
  654. Writeln('    Kaufman & Wilson.  Electronics Technology.  McGraw-Hill.         ');
  655. Writeln('    Edminister, J.     Electric Circuits.       McGraw-Hill.         ');
  656. Writeln;
  657. Writeln('    The above titles have been winnowed from a huge number of books. ');
  658. Writeln('    Few truly good books have ever been written.                     ');
  659. Writeln;
  660. Writeln('    Addtional public-domain programs in the foundations of mathematics ');
  661. Writeln('      and science are being written.  Why don`t you write them too?    ');
  662. Writeln('       __________________________________________________________    ');
  663.  
  664.   Key;Clrscr;
  665. Gotoxy(20,9); Write(' End Of Program Math22 of the Series:');
  666. Gotoxy(20,10); Write('Foundations of Science and Mathematics.');
  667.     Xlow:=17; Yhi:=7; Hlen:=42; Vlen:=4;  Boxes;
  668.  
  669. Gotoxy(20,15); Write('    The Program Math23 will cover     ');
  670. Gotoxy(20,16); Write('    Systems of Linear Equations.      ');
  671. Gotoxy(20,17); Write('    ----------------------------      ');
  672. Gotoxy(23,24);
  673. Write('Press `M` for Menu, `Q` to Quit.');
  674.   Repeat
  675.     Read(Kbd,Ch);
  676.     Ch:=Upcase(Ch);
  677.   until (Ch in ['M','Q']);
  678. If Ch='M' then MainControl;
  679. Halt;
  680.  
  681. end;
  682. {-------------------------------------------------------------------}
  683.  
  684. Procedure MainControl;
  685. Begin           clrscr;
  686.    Assign(Ccontrol,'Control.com');
  687.  
  688. Gotoxy(1, 5);
  689. Writeln('                         Foundations of Mathematics   ');
  690. Writeln('                         ~~~~~~~~~~~~~~~~~~~~~~~~~~   ');
  691. Writeln;
  692. Writeln;
  693. Writeln('                    TRIANGLES, the THEOREM OF PYTHAGORAS, ');
  694. Writeln('                                                       ');
  695. Writeln('                          and Their Relationships      ');
  696.  
  697. Gotoxy(1,13);
  698.   Writeln; Writeln;
  699. Writeln('              1 Describing our approach.   4 Beyond triangles.       ');
  700. Writeln('              2 Pythagoras`s Theorem.      5 Comments & references.  ');
  701. Writeln('              3 Triangles & other topics.                            ');
  702. Writeln('                                 C Control program.                  ');
  703. Writeln('                   _________________________________________         ');
  704.  
  705.   Gotoxy(24,25); Write('    Press key for choice.');
  706.  
  707.            Xlow:=18; Hlen:=40;
  708.             Yhi:= 7; Vlen:= 5;  Boxes;
  709. Gotoxy(1,25);Write('Math22');
  710. Gotoxy(70,25);Write('Oct 1985');
  711.  
  712. Gotoxy( 2,15); Write('I want no.');
  713.   Repeat
  714.     Read(Kbd,ch);
  715.     Ch:=Upcase(Ch);
  716.   until (Ch in ['1','2','3','4','5','C']);
  717.     If ch='1' then Approach;
  718.     If ch='2' then PythagGraf;
  719.     If ch='3' then Hooks;
  720.     If ch='4' then More;
  721.     If ch='5' then Comment;
  722.     If ch='C' then Execute(Ccontrol);
  723.  
  724. end;   (* Procedure MainControl. *)
  725.  
  726. {-------------------------------------------------------------------}
  727. Begin   ex:=#253;              (* *** MAIN PROGRAM *** *)
  728.  
  729. MainControl;
  730.   Textmode(2);
  731. End.
  732.  
  733. {===================================================================}
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.